import asyncio

from common.log import logger
from bot.insurance_planner_gpt.db.redis.hz_dialogue_storage import HzDialogueStorage

hzDialogueStorage = HzDialogueStorage()


async def user_ask_hangup(session_id, data, date_time):
    logger.info('[set_tele_wechat_skill_hangup] 保存挂断信息标识 执行时间:{} sessionId:{} 结果:{}'
                .format(session_id, data, date_time))
    asyncio.ensure_future(hzDialogueStorage.set_tele_wechat_skill_hangup(session_id, data))


async def set_add_wechat(session_id, data, date_time):
    logger.info('[set_add_wechat] 保存发起加微标识 执行时间:{} sessionId:{} 结果:{}'
                .format(session_id, data, date_time))
    asyncio.ensure_future(hzDialogueStorage.set_is_add_wechat(session_id, data))


async def delete_data(session_id):
    asyncio.ensure_future(hzDialogueStorage.del_tele_wechat_skill_hangup(session_id))
    asyncio.ensure_future(hzDialogueStorage.del_is_add_wechat(session_id))
